//
//  UIButton+Extension.swift
//  传智新浪微博
//
//  Created by app on 17/6/2.
//  Copyright © 2017年 app. All rights reserved.
//

import UIKit

extension UIButton {
    
    class func lwh_textButton(title: String, fontSize: CGFloat, normalColor: UIColor, highlightedColor: UIColor) -> UIButton {
        
        let button = UIButton(type: .custom)
        button.setTitle(title, for: UIControlState(rawValue: 0))
        button.setTitleColor(normalColor, for: UIControlState.normal)
        button.setTitleColor(highlightedColor, for: UIControlState.highlighted)
        button.titleLabel?.font = UIFont(name: "STHeitiTC-Light", size: fontSize)
        button.sizeToFit()
        
        return button
    }
    
    
    class func lwh_imgButton(title: String, fontSize: CGFloat, normalColor: UIColor, highlightedColor: UIColor, backgroundImageName: String) -> UIButton {
        
        let button = UIButton(type: .system)
        button.setTitle(title, for: UIControlState(rawValue: 0))
        button.setTitleColor(normalColor, for: UIControlState.normal)
        button.setTitleColor(highlightedColor, for: UIControlState.highlighted)
        button.titleLabel?.font = UIFont(name: "STHeitiTC-Light", size: fontSize)
        button.setBackgroundImage(UIImage(named: backgroundImageName), for: .normal)
        button.sizeToFit()

        return button
    }

}
